<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="checkbox" value="1" name="check" checked="checked" />
    <input type="checkbox" value="2" name="check"  />
    <input type="checkbox" value="3" name="check" checked="checked" />
    <input type="checkbox" value="4" name="check"   />
    <script src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.3.1/jquery.min.js"></script>
    <script>

    var a = $("input[type='checkbox']:checked").length
    console.log(a);


    </script>
</body>
</html>